home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Mania 6
/
MacMania 6.toast
/
/
Tools&Utilities
/
EnterAct Stuff
/
Drag_on Modules
/
hAWK example progs
/
$AcroTester
next >
Wrap
Text File
|
1994-01-26
|
724b
|
25 lines
BEGIN { find = "(^|[^@])([A-Z][A-Z]+)"
rep["CA"] = "California"
rep["HYPO"] = "hypobetalipoproteinemia"
rep["RE"] = "regular expression"
#...etc...
rep["SOM"] = "osoma"
}
{loopCount = 0;
while (match($0, find) && loopCount++ < 50)
{
acronym= substr($0, RSTART, RLENGTH)
sub(find, "\2", acronym)
##gsub(/[^A-Z@#]/, "", acronym)
if (acronym in rep)
sub(find, "\1" rep[acronym])#replace acronym by expansion
else
sub(find, "\1@#@\2")#stick '@#@' in front of unknown acronym
}
if (loopCount >= 50)
{
print "The acronym", acronym, "is looping forever." ; exit
}
gsub(/@#@/, "")#trim the protector by replacing it with null string
print >> (STDPATH "junker")#print the altered line to stdout
}